home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Buffers / ConstBufferOf.cp < prev    next >
Encoding:
Text File  |  1997-06-28  |  826 b   |  41 lines  |  [TEXT/CWIE]

  1. // ConstBufferOf.cp
  2.  
  3. #ifndef ConstBufferOf_h
  4. #include "ConstBufferOf.h"
  5. #endif
  6. #ifndef BufferOf_h
  7. #include "BufferOf.h"
  8. #endif
  9.  
  10. template < class Element >
  11. ConstBufferOf<Element>::ConstBufferOf( ConstArrayType theSpace )
  12.   : space( theSpace ),
  13.      unused( theSpace )
  14.   {
  15.     Assert( !theSpace.Null() );
  16.   }
  17.  
  18. template < class Element >
  19. void ConstBufferOf<Element>::Reset( ConstArrayType theSpace )
  20.   {
  21.     Assert( !theSpace.Null() );
  22.     space = theSpace;
  23.     unused = theSpace;
  24.   }
  25.  
  26. template < class Element >
  27. void ConstBufferOf<Element>::operator>>( ArrayType target )
  28.   {
  29.     AdvanceMark( target << Unused() );
  30.   }
  31.  
  32. template < class Element >
  33. void ConstBufferOf<Element>::operator>>( BufferType& target )
  34.   {
  35.     uint32 amount = target.Unused() << Unused();
  36.     AdvanceMark( amount );
  37.     target.AdvanceMark( amount );
  38.   }
  39.  
  40. #include "ConstArrayOf.cp"
  41.